home *** CD-ROM | disk | FTP | other *** search
/ Nautilus 1992 July / Nautilus-3-8 / Nautilus-3-8.bin / Tools & Utilities / Techy Stuff / Source ƒ / sky source ƒ / VENUS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-16  |  3.4 KB  |  179 lines

  1. #include "sky.h"
  2.  
  3. extern struct venust
  4. {
  5.     float f[2];
  6.     char c[3];
  7. } venust[];
  8.  
  9. venus()
  10. {
  11.     double pturbl, pturbb, pturbr;
  12.     double lograd;
  13.     double dele, enom, vnom, nd, sl;
  14.     double q0, v0, t0, m0, j0 , s0;
  15.     double lsun, elong, ci, dlong;
  16.     double planp[7];
  17.     struct venust *pp = &venust[0];
  18.     double olong;
  19.     double temp;
  20.  
  21. /*
  22.  *    The arguments nnd coefficients are taken from
  23.  *    Simon Newcomb, Tables of the Heliocentric Motion
  24.  *    of Venus
  25.  *    A.P.A.E. VI, part 3 (1895).
  26.  *
  27.  *    Here are the mean orbital elements.
  28.  */
  29.  
  30.     object = "Venus       ";
  31.     ecc = .00682069 - .00004774*capt + 0.091e-6*capt2;
  32.     incl = 3.393631 + .0010058*capt - 0.97e-6*capt2;
  33.     node = 75.779647 + .89985*capt + .00041*capt2;
  34.     argp = 130.163833 + 1.408036*capt - .0009763*capt2;
  35.     mrad = .7233316;
  36.     anom = 212.603219 + 1.6021301540*eday + .00128605*capt2;
  37.     motion = 1.6021687039;
  38.  
  39.     incl *= radian;
  40.     node *= radian;
  41.     argp *= radian;
  42.     anom = fmod(anom, 360.)*radian;
  43.     motion *= radian;
  44.  
  45. /*
  46.  *    Conventional mean anomalies of perturbing planets.
  47.  */
  48.  
  49.     q0 = 102.35 + 4.092338439*eday;
  50.     v0 = 212.60 + 1.602130154*eday;
  51.     t0 = 358.63  + .985608747*eday;
  52.     m0 = 319.74 + 0.524032490*eday;
  53.     j0 = 225.43 + .083090842*eday;
  54.     s0 = 175.8  + .033459258*eday;
  55.  
  56.     q0 *= radian;
  57.     v0 *= radian;
  58.     t0 *= radian;
  59.     m0 *= radian;
  60.     j0 *= radian;
  61.     s0 *= radian;
  62.  
  63.     planp[1] = q0;
  64.     planp[2] = v0;
  65.     planp[3] = t0;
  66.     planp[4] = m0;
  67.     planp[5] = j0;
  68.     planp[6] = s0;
  69.  
  70. /*
  71.  *    Computation of long period terms affecting the mean anomaly.
  72.  *        13*earth - 8.*venus
  73.  *        4*mars - 7.*earth + 3.*venus
  74.  *        saturn
  75.  */
  76.  
  77.     anom +=
  78.       (2.761-0.022*capt)*radsec*sin((237.24+150.27*capt)*radian)
  79.      + 0.269*radsec*sin((212.2+119.05*capt)*radian)
  80.      - 0.208*radsec*sin((175.8+1223.5*capt)*radian);
  81.  
  82. /*
  83.  *    Computation of elliptic orbit.
  84.  */
  85.  
  86.     enom = anom + ecc*sin(anom);
  87.     do {
  88.         dele = (anom - enom + ecc * sin(enom)) /
  89.             (1. - ecc*cos(enom));
  90.         enom += dele;
  91.     } while(fabs(dele) > 1.e-8);
  92.     vnom = 2.*atan2(sqrt((1.+ecc)/(1.-ecc))*sin(enom/2.),
  93.             cos(enom/2.));
  94.     rad = mrad*(1. - ecc*cos(enom));
  95.  
  96. /*
  97.  *    Perturbations in longitude.
  98.  */
  99.  
  100.     pturbl = 0.;
  101.     for(;;){
  102.         if(pp->f[0]==0.){
  103.             pp++;
  104.             break;
  105.         }
  106.         pturbl += pp->f[0]*cos(pp->f[1] + pp->c[0]*v0 + pp->c[1]*planp[pp->c[2]]);
  107.         pp++;
  108.     }
  109.  
  110. /*
  111.  *    Perturbations in latitude.
  112.  */
  113.  
  114.     pturbb = 0.;
  115.     for(;;){
  116.         if(pp->f[0]==0.){
  117.             pp++;
  118.             break;
  119.         }
  120.         pturbb += pp->f[0]*cos(pp->f[1] + pp->c[0]*v0 + pp->c[1]*planp[pp->c[2]]);
  121.         pp++;
  122.     }
  123.  
  124. /*
  125.  *    Perturbations in log radius vector.
  126.  */
  127.  
  128.     pturbr = 0.;
  129.     for(;;){
  130.         if(pp->f[0]==0.){
  131.             pp++;
  132.             break;
  133.         }
  134.         pturbr += pp->f[0]*cos(pp->f[1] + pp->c[0]*v0 + pp->c[1]*planp[pp->c[2]]);
  135.         pp++;
  136.     }
  137.     pturbr *= 1.e-6;
  138.  
  139. /*
  140.  *    reduce to the ecliptic
  141.  */
  142.  
  143.     olong = vnom + argp + pturbl*radsec;
  144.     nd = olong - node;
  145.     lambda = node + atan2(sin(nd)*cos(incl), cos(nd));
  146.  
  147.     sl = sin(incl)*sin(nd);
  148.     beta = atan2(sl, sqrt(1.-sl*sl)) + pturbb*radsec;
  149.  
  150.     lograd = pturbr*2.30258509;
  151.     rad *= 1. + lograd;
  152.  
  153. /*
  154.  *    Compute motion for planetary aberration.
  155.  */
  156.  
  157.     temp = motion*mrad*mrad*sqrt(1.-ecc*ecc)/(rad*rad);
  158.     ldot = temp*sin(2.*(lambda-node))/sin(2.*(olong-node));
  159.     bdot = temp*sin(incl)*cos(lambda-node);
  160.     rdot = motion*mrad*ecc*sin(olong-argp)/sqrt(1.-ecc*ecc);
  161.  
  162. /*
  163.  *    Compute magnitude.
  164.  */
  165.  
  166.     lsun = 99.696678 + 0.9856473354*eday;
  167.     lsun *= radian;
  168.     elong = lambda - lsun;
  169.     ci = (rad - cos(elong))/sqrt(1. + rad*rad - 2.*rad*cos(elong));
  170.     dlong = atan2(sqrt(1.-ci*ci), ci)/radian;
  171.     mag = -4.00 + .01322*dlong + .0000004247*dlong*dlong*dlong;
  172.  
  173.     semi = 8.41;
  174.  
  175.     helio();
  176.     geo();
  177.  
  178. }
  179.